BIN=myproc #目标文件
CC=gcc     #编译器
SRC=$(shell ls *.c)  #执行文件
OBJ=$(SRC:.c=.o)
LFLAGS=-o   #执行选项
FLAGS=-c
RM=rm -f

$(BIN):$(OBJ)
	$(CC) $(LFLAGS) $@ $^
	@echo "linking ... $^ to $@"
%.o:%.c
	$(CC) $(FLAGS) $<
	@echo "compling ... $< to $@"

.PHONY:clean
clean:
	$(RM) $(OBJ) $(BIN)

.PHONY:test
test:
	@echo $(SRC)
	@echo $(OBJ)




#$(BIN):$(SRC)
#	@$(CC) $(FLAGS) $@ $^
#	@echo "linking ... $^ to $@"
#.PHONY:
#clean:
#	@$(RM) $(BIN)
#	@echo "remove ... $(BIN)"
#
#
#.PHONY:test
#test:
#	@echo $(BIN)
#	@echo $(CC)
#	@echo $(SRC)
#	@echo $(FLAGS)

#mycode:myproc.c
#	gcc -o myproc myproc.c   
#.PHONY:clean
#clean:
#	rm -f myproc
